Kafka Data Intake Test Client

Purpose

Use this client to send a Data Intake test XML file to Kafka in this order:

  1. `beginLoading`

  2. One or more `addRecord` messages

  3. `completeLoading`

  4. `process`

The client waits for Kafka to acknowledge each message. If a message cannot be sent, the error is displayed before the client moves to the next step. This playbook covers both supported authentication mechanisms:

  • - `SCRAM-SHA-512`

  • - OAuth 2.0 using `OAUTHBEARER`

Use only the configuration for the mechanism assigned to the QA environment. Do not combine the SCRAM and OAuth properties in one active configuration.

Information required before starting

Obtain the following values from the Kafka or environment administrator:

  • Kafka bootstrap server list, for example `broker1.example.com:9093,broker2.example.com:9093`

  • Kafka Data Intake topic name

  • Authentication mechanism: `SCRAM-SHA-512` or `OAUTHBEARER`

  • PKCS12 truststore file and password

  • For SCRAM: Kafka username and password

  • For OAuth: client ID, client secret, and HTTPS token endpoint URL

  • OAuth scope, only when required by the identity provider

  • A Data Intake XML test file with the correct group customer number, profile name, and XPath values for the target environment

Do not store real passwords or client secrets in source control, email, test evidence, screenshots, or shared chat messages.

Prepare the client

  1. Install a supported JDK and confirm Java is available:

    ```text

    java -version

    ```

  2. Extract the `pas.di.testclient-...-distribution.zip` file to a local folder.

  3. Confirm that the extracted folder contains these directories:

    ```text

    bin

    conf

    lib

    test

    ```

  4. Copy the Data Intake scenario XML file into the `test` directory.

  5. Confirm that each record template uses a capitalized `<Record>` element inside `<testFile>`. The supplied record must be part of a complete `<dataIntakeScenario>` document; a standalone `<Record>` is not sufficient.

  6. Use `${random.taxId}` wherever the generated tax ID is required. Within one generated record, every occurrence receives the same tax ID. Different generated records receive different tax IDs.

Create the Kafka properties file

The distribution includes `conf/KafkaClient.properties`. This file already contains configuration examples for both SCRAM-SHA-512 and OAuth/OAUTHBEARER.

Keep only the properties for the authentication mechanism assigned to the QA environment active, and comment out the other mechanism's properties. Replace every `replace_with_...` value in the active configuration.

The startup script uses `conf/KafkaClient.properties` by default. Alternatively, copy it to a secure local location and pass the copy's full path to the startup script. Keeping QA credentials outside the extracted distribution makes it less likely that they will be shared accidentally.

On Windows, use forward slashes in file paths inside a Java properties file,

for example:

```properties

ssl.truststore.location=C:/qa/certs/kafka.client.truststore.p12

```

Option A — SCRAM-SHA-512

The completed properties file must have this structure:

```properties

topic.name=replace_with_data_intake_topic bootstrap.servers=replace_with_broker1:9093,replace_with_broker2:9093 client.id=oipa-data-intake-test client acks=all


security.protocol=SASL_SSL

sasl.mechanism=SCRAM-SHA-512

sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="replace_with_username" password="replace_with password";


ssl.truststore.location=replace_with_full_path_to_kafka.client.truststore.p12

ssl.truststore.password=replace_with_truststore_password

ssl.truststore.type=PKCS12

enable.idempotence=false

```

SCRAM does not require the OAuth token endpoint or OAuth callback-handler properties. Do not leave active OAuth properties in this file.

Option B — OAuth/OAUTHBEARER

The completed properties file must have this structure:

``properties

topic.name=replace_with_data_intake_topic bootstrap.servers=replace_with_broker1:9093,replace_with_broker2:9093 client.id=oipa-data-intake-test client acks=all

security.protocol=SASL_SSL

sasl.mechanism=OAUTHBEARER

sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required clientId="replace_with_client_id" clientSecret="replace_with_client_secret";

sasl.login.callback.handler.class=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginCallbackHandler

sasl.oauthbearer.token.endpoint.url=https://replace_with_identity_provider/token


# Uncomment and set this only when the identity provider requires a scope.

# sasl.oauthbearer.scope=replace_with_scope


ssl.truststore.location=replace_with_full_path_to_kafka.client.truststore.p12

ssl.truststore.password=replace_with_truststore_password

ssl.truststore.type=PKCS12

enable.idempotence=false

```

OAuth requires one additional truststore step before starting the client. This allows Java to trust the HTTPS certificate presented by the OAuth token endpoint. Run the command in the same terminal that will run the client.

Windows Command Prompt:

```bat

set "JAVA_OPTS=-Djavax.net.ssl.trustStore=/path/to/keystore/kafka.client.truststore.p12 -Djavax.net.ssl.trustStoreType=PKCS12 -Djavax.net.ssl.trustStorePassword=<actual-password>"

```

Replace `/path/to/keystore/kafka.client.truststore.p12` and `<actual-password>` with the real values. Do not include the angle brackets in the actual password.

Windows PowerShell equivalent:

```powershell

$env:JAVA_OPTS='-Djavax.net.ssl.trustStore=C:/qa/certs/kafka.client.truststore.p12 -Djavax.net.ssl.trustStoreType=PKCS12 -Djavax.net.ssl.trustStorePassword=actual-password'

```

Linux/Unix equivalent:

```sh

export JAVA_OPTS='-Djavax.net.ssl.trustStore=/path/to/keystore/kafka.client.truststore.p12 -Djavax.net.ssl.trustStoreType=PKCS12 -Djavax.net.ssl.trustStorePassword=actual-password'

```

The `ssl.truststore.*` properties secure the Kafka TLS connection. The `JAVA_OPTS` truststore settings are also required for the OAuth HTTPS token request in environments where its certificate is not already trusted by the JDK. The same PKCS12 file may be used when it contains all required certificate authorities.

Start the client

Windows

  1. Open Command Prompt.

  2. For OAuth, run the `set "JAVA_OPTS=..."` command from the preceding section.

  3. Change to the extracted `bin` directory.

  4. Start the client and pass the full path to the completed properties file:

    ```bat

    startup-kafka.bat C:\qa-config\KafkaClient.properties

    ```

If the default `conf\KafkaClient.properties` was intentionally configured, run:

```bat

startup-kafka.bat

```

Linux/Unix

  1. Set `JAVA_HOME` to the JDK installation.

  2. For OAuth, export `JAVA_OPTS` as shown above.

  3. Change to the extracted `bin` directory.

  4. Run:

    ```sh

    sh startup-kafka.sh /qa-config/KafkaClient.properties

    ```

The startup output displays the absolute Kafka configuration path. Verify that it is the file prepared for the current QA environment before continuing.

Final pre-run checklist

  • [ ] Correct QA environment and Kafka topic confirmed

  • [ ] Correct authentication mechanism configured

  • [ ] Every `replace_with_...` value replaced

  • [ ] Truststore path, type, and password confirmed

  • [ ] OAuth `JAVA_OPTS` set in the current terminal, when applicable

  • [ ] Complete scenario XML copied to `test`

  • [ ] Group customer number, profile name, and XPath values verified

  • [ ] Intended record count confirmed

Sample KafkaClient.properties screenshot attached here

Run the Data Intake scenario

Follow the prompts in this order:

  1. At `ENTER NUMBER FOR TEST TO RUN`, enter the number shown beside the required XML file. Enter `Q` to exit without running a test.

  2. At `ENTER NUMBER OF RECORDS TO ADD (1 OR MORE)`, enter:

    1. `1` to run each `<Record>` template once, preserving the original flow.

    2. A number greater than `1` to create that many copies of each `<Record>` template. Each copy receives a different `${random.taxId}` value.

      For example, a scenario containing one `<Record>` template with a value of `5` sends five `addRecord` messages. A scenario containing two templates sends ten messages. The `expectedRecordCount` sent by `beginLoading` is adjusted automatically.

  3. At `PRESS ENTER TO SEND BEGIN LOADING`, press Enter once.

  4. At `PRESS ENTER TO ADD RECORDS`, press Enter once. The client sends every generated `addRecord` message and waits for Kafka acknowledgement.

  5. At `PRESS ENTER TO COMPLETE LOADING`, press Enter once.

  6. At `PRESS ENTER TO PROCESS THE FILE`, press Enter once.

Do not close the terminal while records are being sent. For a high record count, wait until the next prompt appears before taking the next action.

Sample Screenshots:

Sample Record :SingleRecordNewMemberTest.xml

will enter 2 to add two records.

We have receieved 2 records in the cycle server for DI processing through kafka consumer.

Confirm a successful run

A successful client run has all of these characteristics:

  • No exception or Kafka error is displayed in the terminal.

  • All four stages complete in order.

  • The expected number of `addRecord` messages is visible in the Kafka consumer or server-side Data Intake logs.

  • The Data Intake file reaches the expected status in the application.

  • The generated member tax IDs are different across generated records.

Capture evidence according to the QA test plan, but mask usernames, passwords, client secrets, access tokens, and truststore passwords.

Cleanup

  1. Enter `Q` at the test selection menu to close the client.

  2. Close the terminal to clear the session-level `JAVA_OPTS` value.

  3. Remove temporary properties files when required by the QA security policy.

  4. Store approved test evidence only in the designated location.